﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BCCommon.FreightEnums;
using BCEntity.Common.Area;

namespace BCData.Common.Area
{
    /// <summary>
    /// 省份
    /// </summary>
    public interface IProvinceData
    {
        /// <summary>
        /// 添加省份信息
        /// </summary>
        /// <param name="entity">省份信息</param>
        /// <returns></returns>
        bool Add(ProvinceEntity entity);
        /// <summary>
        /// 删除省份信息
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <returns></returns>
        bool Delete(string provinceCode);
        /// <summary>
        /// 更新省份信息
        /// </summary>
        /// <param name="entity">省份信息</param>
        /// <returns></returns>
        bool Update(ProvinceEntity entity);
        /// <summary>
        /// 获取省份信息
        /// </summary>
        /// <param name="provinceId">省份Id</param>
        /// <returns></returns>
        ProvinceEntity GetProvince(long provinceId);
        /// <summary>
        /// 获取省份信息
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <returns></returns>
        ProvinceEntity GetProvince(string provinceCode);
        /// <summary>
        /// 获取所有省份信息
        /// </summary>
        /// <returns></returns>
        IEnumerable<ProvinceEntity> GetProvinces();
        /// <summary>
        /// 分页获取省份信息
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <param name="index">当前页码</param>
        /// <param name="size">每页数据条数</param>
        /// <param name="dataCount">数据总数</param>
        /// <returns></returns>
        IEnumerable<ProvinceEntity> GetProvinces(string provinceCode, int index, int size, out int dataCount);
        /// <summary>
        /// 检查省份信息是否存在
        /// </summary>
        /// <param name="provinceId">省份Id</param>
        /// <returns></returns>
        bool CheckProvinceExistsById(long provinceId);
        /// <summary>
        /// 检查省份信息是否存在
        /// </summary>
        /// <param name="provinceName">省份名称</param>
        /// <returns></returns>
        bool CheckProvinceExistsByName(string provinceName);
        /// <summary>
        /// 检查省份信息是否存在
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <returns></returns>
        bool CheckProvinceExistsByCode(string provinceCode);
        /// <summary>
        /// 检查省份编码是否被使用中
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <returns></returns>
        bool CheckProvinceIdInUsed(string provinceCode);
        /// <summary>
        /// 修改省份议价
        /// </summary>
        /// <param name="provinceCode">省份编码</param>
        /// <param name="businessType">业务类型</param>
        /// <param name="isNegotiatedPrice">需要议价</param>
        /// <returns></returns>
        Task<int> UpdateProvinceNegotiatedPrice(string provinceCode, FreightBusinessType businessType, bool isNegotiatedPrice);
        /// <summary>
        /// 更改省份坐标
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="provinceCode">代码</param>
        /// <param name="longitude">经度</param>
        /// <param name="latitude">纬度</param>
        /// <param name="colName">列名</param>
        /// <returns></returns>
        bool UpdateCoordinate(string tableName, string provinceCode, double longitude, double latitude );

        /// <summary>
        /// 检查省份信息是否存在
        /// </summary>
        /// <param name="provinceName">省份名称</param>
        /// <param name="provinceUuid">省份UUID</param>
        /// <param name="provinceCode">省份编码</param>
        /// <returns></returns>
        Task<ProvinceEntity> GetProvinceAsync(string provinceName, string provinceUuid, string provinceCode);

        /// <summary>
        /// 添加省份信息
        /// </summary>
        /// <param name="entity">省份信息</param>
        /// <param name="batchNo">批号</param>
        /// <returns></returns>
        Task<int> AddProvinceAsync(ProvinceEntity entity, string batchNo);

        /// <summary>
        /// 不存在新地图信息插入未匹配上的数据
        /// </summary>
        /// <param name="batchNo">批号</param>
        /// <returns></returns>
        Task<bool> UpdateIsEnabledAsync(string batchNo);

        /// <summary>
        /// 更新省份信息
        /// </summary>
        /// <param name="entity">新省份信息</param>
        /// <param name="batchNo">批号</param>
        /// <param name="provinceResult">旧省份信息</param>
        /// <param name="isMatch">是否匹配上</param>
        /// <returns></returns>
        Task<int> UpdateProvinceAsync(ProvinceEntity entity, string batchNo, ProvinceEntity provinceResult, bool? isMatch);
    }
}
